package com.funcablaze.tpxterm.window;

import javafx.fxml.Initializable;
import javafx.stage.Stage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.net.URL;
import java.util.ResourceBundle;

public abstract class WindowController implements Initializable {
	
	public abstract void initialize(URL location, ResourceBundle resources);
	
	private Callback callback;
	
	public void setInfo(@Nullable Callback callback) {
		this.callback = callback;
	}
	
	public boolean backWith(Object result) {
		if (callback != null) {
			callback.onDataReceived(result);
			return true;
		}
		return false;
	}
	
	public interface Callback {
		void onDataReceived(Object result);
	}
}
